
from rest_framework.response import Response
from book import models,serailizer
from rest_framework.views import APIView
# Create your views here.
class BookView(APIView):
    def get(self,request):
        booklist = models.Book.objects.filter(position=0,flag=True).order_by("order")
        ser = serailizer.BookSerializer(booklist,many=True)
        return Response({"code":"200","msg":"ok","data":ser.data})

class FootNav(APIView):
    def get(self,request):
        nav_list = models.Book.objects.filter(position=1,flag=True).order_by('order')
        ser = serailizer.BookSerializer(nav_list,many=True)
        return Response({"code":200,"msg":"ok","data":ser.data})